package cn.ecut.service.impl;

import cn.ecut.dao.AlumniDao;
import cn.ecut.dao.ScholarshipDao;
import cn.ecut.model.Alumni;
import cn.ecut.model.Scholarship;
import cn.ecut.service.ScholarshipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ScholarshipServiceimpl implements ScholarshipService {
    @Autowired
    private ScholarshipDao scholarshipDao;
    @Override
    public List<Alumni> selectAllAlumni() {
        return scholarshipDao.selectAllAlumni();
    }

    @Override
    public Integer addScholarship(Scholarship scholarship) {
        return scholarshipDao.addScholarship(scholarship);
    }

    @Override
    public List<Scholarship> selectAllScholarship(int offset,int num) {
        return scholarshipDao.selectAllScholarship(offset,num);
    }

    @Override
    public Integer selectAllcount() {
        return scholarshipDao.selectAllcount();
    }

    @Override
    public Integer updataResidu(Integer sid, Integer sum) {
        return scholarshipDao.selectResiduBySid(sid)+(sum-scholarshipDao.selectSumBySid(sid));
    }

    @Override
    public Integer updataScholarship(Scholarship scholarship) {
        return scholarshipDao.updataScholarship(scholarship);
    }

    @Override
    public Integer deleteBySid(Integer sid) {
        return scholarshipDao.deleteBySid(sid);
    }

    @Override
    public List<Scholarship> advanceSelect(String s, int offset, int num) {
        return scholarshipDao.advanceSelect(s, offset, num);
    }

    @Override
    public Integer advanceSelectCount(String s) {
        return scholarshipDao.advanceSelectCount(s);
    }

    @Override
    public Scholarship selectDetailScholarshipBySid(Integer sid) {
        return scholarshipDao.selectDetailScholarshipBySid(sid);
    }
}
